﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Model
{
    [Serializable]
    public partial class Sto8a01
    {
		private string _dtlid;
		private string _dtldoctype;
		private string _dtlwarehouseid;
		private string _dtldocid;
		private string _merchid;
		private string _spno;
		private double _startbuyqty;
		private double _dtlqty;
		private double _dtlstockqty;
		private double _dtlprice;
		private double _dtltotalamt;
		private double _preqty1;
		private double _preprice1;
		private double _preamt1;
		private double _preqty2;
		private double _preprice2;
		private double _preamt2;
		private double _preqty3;
		private double _preprice3;
		private double _preamt3;
		private double _actqty1;
		private double _actprice1;
		private double _actamt1;
		private double _actqty2;
		private double _actprice2;
		private double _actamt2;
		private double _actqty3;
		private double _actprice3;
		private double _actamt3;
		private string _cause;
		private string _text3;
		private string _text2;
		private string _text1;
		private double _cess;
		private double _cessamt;
		private string _dtlrefno1;
		private string _dtlrefno2;
		private string _dtlrefno3;
        private DateTime? _dtldate2;
        private DateTime? _dtldate;
		private string _dtlremark;
		private string _dtlremark2;
		
        /// <summary>
        /// 主键ID
        /// </summary>
		public string Dtlid
		{
			get { return _dtlid;	 }
			set { _dtlid=value;	}
		}
        /// <summary>
        /// 单据类型
        /// </summary>
		public string Dtldoctype
		{
			get { return _dtldoctype;	 }
			set { _dtldoctype=value;	}
		}
        /// <summary>
        /// 仓库
        /// </summary>
		public string Dtlwarehouseid
		{
			get { return _dtlwarehouseid;	 }
			set { _dtlwarehouseid=value;	}
		}
        /// <summary>
        /// 表头ID
        /// </summary>
		public string Dtldocid
		{
			get { return _dtldocid;	 }
			set { _dtldocid=value;	}
		}
        /// <summary>
        /// 商品ID
        /// </summary>
		public string Merchid
		{
			get { return _merchid;	 }
			set { _merchid=value;	}
		}
        /// <summary>
        /// 销售商货号
        /// </summary>
		public string Spno
		{
			get { return _spno;	 }
			set { _spno=value;	}
		}
        /// <summary>
        /// 起订数量
        /// </summary>
		public double Startbuyqty
		{
			get { return _startbuyqty;	 }
			set { _startbuyqty=value;	}
		}
        /// <summary>
        /// 明细数量
        /// </summary>
		public double Dtlqty
		{
			get { return _dtlqty;	 }
			set { _dtlqty=value;	}
		}
        /// <summary>
        /// 库存数量
        /// </summary>
		public double Dtlstockqty
		{
			get { return _dtlstockqty;	 }
			set { _dtlstockqty=value;	}
		}
        /// <summary>
        /// 单价
        /// </summary>
		public double Dtlprice
		{
			get { return _dtlprice;	 }
			set { _dtlprice=value;	}
		}
        /// <summary>
        /// 合计金额
        /// </summary>
		public double Dtltotalamt
		{
			get { return _dtltotalamt;	 }
			set { _dtltotalamt=value;	}
		}
        /// <summary>
        /// 预计数量1
        /// </summary>
		public double Preqty1
		{
			get { return _preqty1;	 }
			set { _preqty1=value;	}
		}
        /// <summary>
        /// 预计单价1
        /// </summary>
		public double Preprice1
		{
			get { return _preprice1;	 }
			set { _preprice1=value;	}
		}
        /// <summary>
        /// 预计金额1
        /// </summary>
		public double Preamt1
		{
			get { return _preamt1;	 }
			set { _preamt1=value;	}
		}
        /// <summary>
        /// 预计数量2
        /// </summary>
		public double Preqty2
		{
			get { return _preqty2;	 }
			set { _preqty2=value;	}
		}
        /// <summary>
        /// 预计单价2
        /// </summary>
		public double Preprice2
		{
			get { return _preprice2;	 }
			set { _preprice2=value;	}
		}
        /// <summary>
        /// 预计金额2
        /// </summary>
		public double Preamt2
		{
			get { return _preamt2;	 }
			set { _preamt2=value;	}
		}
        /// <summary>
        /// 预计数量3
        /// </summary>
		public double Preqty3
		{
			get { return _preqty3;	 }
			set { _preqty3=value;	}
		}
        /// <summary>
        /// 预计单价3
        /// </summary>
		public double Preprice3
		{
			get { return _preprice3;	 }
			set { _preprice3=value;	}
		}
        /// <summary>
        /// 预计金额3
        /// </summary>
		public double Preamt3
		{
			get { return _preamt3;	 }
			set { _preamt3=value;	}
		}
        /// <summary>
        /// 实际数量1
        /// </summary>
		public double Actqty1
		{
			get { return _actqty1;	 }
			set { _actqty1=value;	}
		}
        /// <summary>
        /// 实际单价1
        /// </summary>
		public double Actprice1
		{
			get { return _actprice1;	 }
			set { _actprice1=value;	}
		}
        /// <summary>
        /// 实际金额1
        /// </summary>
		public double Actamt1
		{
			get { return _actamt1;	 }
			set { _actamt1=value;	}
		}
        /// <summary>
        /// 实际数量2
        /// </summary>
		public double Actqty2
		{
			get { return _actqty2;	 }
			set { _actqty2=value;	}
		}
        /// <summary>
        /// 实际单价2
        /// </summary>
		public double Actprice2
		{
			get { return _actprice2;	 }
			set { _actprice2=value;	}
		}
        /// <summary>
        /// 实际金额2
        /// </summary>
		public double Actamt2
		{
			get { return _actamt2;	 }
			set { _actamt2=value;	}
		}
        /// <summary>
        /// 实际数量3
        /// </summary>
		public double Actqty3
		{
			get { return _actqty3;	 }
			set { _actqty3=value;	}
		}
        /// <summary>
        /// 实际单价3
        /// </summary>
		public double Actprice3
		{
			get { return _actprice3;	 }
			set { _actprice3=value;	}
		}
        /// <summary>
        /// 实际金额3
        /// </summary>
		public double Actamt3
		{
			get { return _actamt3;	 }
			set { _actamt3=value;	}
		}
        /// <summary>
        /// 原因
        /// </summary>
		public string Cause
		{
			get { return _cause;	 }
			set { _cause=value;	}
		}
        /// <summary>
        /// 自定义字段3
        /// </summary>
		public string Text3
		{
			get { return _text3;	 }
			set { _text3=value;	}
		}
        /// <summary>
        /// 自定义字段2
        /// </summary>
		public string Text2
		{
			get { return _text2;	 }
			set { _text2=value;	}
		}
        /// <summary>
        /// 自定义字段
        /// </summary>
		public string Text1
		{
			get { return _text1;	 }
			set { _text1=value;	}
		}
        /// <summary>
        /// 税率
        /// </summary>
		public double Cess
		{
			get { return _cess;	 }
			set { _cess=value;	}
		}
        /// <summary>
        /// 税额
        /// </summary>
		public double Cessamt
		{
			get { return _cessamt;	 }
			set { _cessamt=value;	}
		}
        /// <summary>
        /// 相关单号
        /// </summary>
		public string Dtlrefno1
		{
			get { return _dtlrefno1;	 }
			set { _dtlrefno1=value;	}
		}
        /// <summary>
        /// 相关单号2
        /// </summary>
		public string Dtlrefno2
		{
			get { return _dtlrefno2;	 }
			set { _dtlrefno2=value;	}
		}
        /// <summary>
        /// 相关单号3
        /// </summary>
		public string Dtlrefno3
		{
			get { return _dtlrefno3;	 }
			set { _dtlrefno3=value;	}
		}
        /// <summary>
        /// 相关日期2
        /// </summary>
		public DateTime? Dtldate2
		{
			get { return _dtldate2;	 }
			set { _dtldate2=value;	}
		}
        /// <summary>
        /// 相关日期
        /// </summary>
		public DateTime? Dtldate
		{
			get { return _dtldate;	 }
			set { _dtldate=value;	}
		}
        /// <summary>
        /// 明细备注
        /// </summary>
		public string Dtlremark
		{
			get { return _dtlremark;	 }
			set { _dtlremark=value;	}
		}
        /// <summary>
        /// 明细备注2
        /// </summary>
		public string Dtlremark2
		{
			get { return _dtlremark2;	 }
			set { _dtlremark2=value;	}
		}
		
		public static List<Sto8a01> GetSto8a01ListByDataTable(DataTable dt)
		{
			if(dt == null) return null;
		    List<Sto8a01> list = new List<Sto8a01>();
		   
			foreach(DataRow dr in dt.Rows)
            {
				Sto8a01 model = GetSto8a01ByDataRow(dr);
				if(null == model) continue;
				
				list.Add(model);
            }
           return list;
		}
		
		public static Sto8a01 GetSto8a01ByDataRow(DataRow dr)
		{
			Sto8a01 model = new Sto8a01(); //实例化Sto8a01
	
			DataColumnCollection dcc = dr.Table.Columns;

			if (dcc.Contains("dtlid")&&!(dr["dtlid"] is System.DBNull))  
				model.Dtlid = ( string)dr["dtlid"];
			if (dcc.Contains("dtldoctype")&&!(dr["dtldoctype"] is System.DBNull))  
				model.Dtldoctype = ( string)dr["dtldoctype"];
			if (dcc.Contains("dtlwarehouseid")&&!(dr["dtlwarehouseid"] is System.DBNull))  
				model.Dtlwarehouseid = ( string)dr["dtlwarehouseid"];
			if (dcc.Contains("dtldocid")&&!(dr["dtldocid"] is System.DBNull))  
				model.Dtldocid = ( string)dr["dtldocid"];
			if (dcc.Contains("merchid")&&!(dr["merchid"] is System.DBNull))  
				model.Merchid = ( string)dr["merchid"];
			if (dcc.Contains("spno")&&!(dr["spno"] is System.DBNull))  
				model.Spno = ( string)dr["spno"];
			if (dcc.Contains("startbuyqty")&&!(dr["startbuyqty"] is System.DBNull))  
				model.Startbuyqty = Convert.ToDouble(dr["startbuyqty"]);
			if (dcc.Contains("dtlqty")&&!(dr["dtlqty"] is System.DBNull))  
				model.Dtlqty = Convert.ToDouble(dr["dtlqty"]);
			if (dcc.Contains("dtlstockqty")&&!(dr["dtlstockqty"] is System.DBNull))  
				model.Dtlstockqty = Convert.ToDouble(dr["dtlstockqty"]);
			if (dcc.Contains("dtlprice")&&!(dr["dtlprice"] is System.DBNull))  
				model.Dtlprice = Convert.ToDouble(dr["dtlprice"]);
			if (dcc.Contains("dtltotalamt")&&!(dr["dtltotalamt"] is System.DBNull))  
				model.Dtltotalamt = Convert.ToDouble(dr["dtltotalamt"]);
			if (dcc.Contains("preqty1")&&!(dr["preqty1"] is System.DBNull))  
				model.Preqty1 = Convert.ToDouble(dr["preqty1"]);
			if (dcc.Contains("preprice1")&&!(dr["preprice1"] is System.DBNull))  
				model.Preprice1 = Convert.ToDouble(dr["preprice1"]);
			if (dcc.Contains("preamt1")&&!(dr["preamt1"] is System.DBNull))  
				model.Preamt1 = Convert.ToDouble(dr["preamt1"]);
			if (dcc.Contains("preqty2")&&!(dr["preqty2"] is System.DBNull))  
				model.Preqty2 = Convert.ToDouble(dr["preqty2"]);
			if (dcc.Contains("preprice2")&&!(dr["preprice2"] is System.DBNull))  
				model.Preprice2 = Convert.ToDouble(dr["preprice2"]);
			if (dcc.Contains("preamt2")&&!(dr["preamt2"] is System.DBNull))  
				model.Preamt2 = Convert.ToDouble(dr["preamt2"]);
			if (dcc.Contains("preqty3")&&!(dr["preqty3"] is System.DBNull))  
				model.Preqty3 = Convert.ToDouble(dr["preqty3"]);
			if (dcc.Contains("preprice3")&&!(dr["preprice3"] is System.DBNull))  
				model.Preprice3 = Convert.ToDouble(dr["preprice3"]);
			if (dcc.Contains("preamt3")&&!(dr["preamt3"] is System.DBNull))  
				model.Preamt3 = Convert.ToDouble(dr["preamt3"]);
			if (dcc.Contains("actqty1")&&!(dr["actqty1"] is System.DBNull))  
				model.Actqty1 = Convert.ToDouble(dr["actqty1"]);
			if (dcc.Contains("actprice1")&&!(dr["actprice1"] is System.DBNull))  
				model.Actprice1 = Convert.ToDouble(dr["actprice1"]);
			if (dcc.Contains("actamt1")&&!(dr["actamt1"] is System.DBNull))  
				model.Actamt1 = Convert.ToDouble(dr["actamt1"]);
			if (dcc.Contains("actqty2")&&!(dr["actqty2"] is System.DBNull))  
				model.Actqty2 = Convert.ToDouble(dr["actqty2"]);
			if (dcc.Contains("actprice2")&&!(dr["actprice2"] is System.DBNull))  
				model.Actprice2 = Convert.ToDouble(dr["actprice2"]);
			if (dcc.Contains("actamt2")&&!(dr["actamt2"] is System.DBNull))  
				model.Actamt2 = Convert.ToDouble(dr["actamt2"]);
			if (dcc.Contains("actqty3")&&!(dr["actqty3"] is System.DBNull))  
				model.Actqty3 = Convert.ToDouble(dr["actqty3"]);
			if (dcc.Contains("actprice3")&&!(dr["actprice3"] is System.DBNull))  
				model.Actprice3 = Convert.ToDouble(dr["actprice3"]);
			if (dcc.Contains("actamt3")&&!(dr["actamt3"] is System.DBNull))  
				model.Actamt3 = Convert.ToDouble(dr["actamt3"]);
			if (dcc.Contains("cause")&&!(dr["cause"] is System.DBNull))  
				model.Cause = ( string)dr["cause"];
			if (dcc.Contains("text3")&&!(dr["text3"] is System.DBNull))  
				model.Text3 = ( string)dr["text3"];
			if (dcc.Contains("text2")&&!(dr["text2"] is System.DBNull))  
				model.Text2 = ( string)dr["text2"];
			if (dcc.Contains("text1")&&!(dr["text1"] is System.DBNull))  
				model.Text1 = ( string)dr["text1"];
			if (dcc.Contains("cess")&&!(dr["cess"] is System.DBNull))  
				model.Cess = Convert.ToDouble(dr["cess"]);
			if (dcc.Contains("cessamt")&&!(dr["cessamt"] is System.DBNull))  
				model.Cessamt = Convert.ToDouble(dr["cessamt"]);
			if (dcc.Contains("dtlrefno1")&&!(dr["dtlrefno1"] is System.DBNull))  
				model.Dtlrefno1 = ( string)dr["dtlrefno1"];
			if (dcc.Contains("dtlrefno2")&&!(dr["dtlrefno2"] is System.DBNull))  
				model.Dtlrefno2 = ( string)dr["dtlrefno2"];
			if (dcc.Contains("dtlrefno3")&&!(dr["dtlrefno3"] is System.DBNull))  
				model.Dtlrefno3 = ( string)dr["dtlrefno3"];
			if (dcc.Contains("dtldate2")&&!(dr["dtldate2"] is System.DBNull))  
				model.Dtldate2 = ( DateTime)dr["dtldate2"];
			if (dcc.Contains("dtldate")&&!(dr["dtldate"] is System.DBNull))  
				model.Dtldate = ( DateTime)dr["dtldate"];
			if (dcc.Contains("dtlremark")&&!(dr["dtlremark"] is System.DBNull))  
				model.Dtlremark = ( string)dr["dtlremark"];
			if (dcc.Contains("dtlremark2")&&!(dr["dtlremark2"] is System.DBNull))  
				model.Dtlremark2 = ( string)dr["dtlremark2"];
			
			return model;
		}
    }
}
